/**
 * 项目名：	Rumba Plan
 * 
 * 版权所有(C)，上海海鼎信息工程股份有限公司，2006，所有权利保留。
 * 
 * 文件名：	BProgress.java
 * 模块说明：	
 * 修改历史：
 * 2006-11-8 - lxm - 创建。
 */
package com.hd123.rumba.runtime.backprocess;

/**
 * 处理进度 | 业务层 | 实现类
 * <p>
 * 
 * 设计符合burlap协议，用于将进度信息传递给客户端。
 * 
 * @author lxm
 * 
 */
public class BProgress {

  private String caption;
  private float minValue = 0;
  private float maxValue = 100;
  private float position = 0;
  private String message;
  private BProgress child = null;

  public void readFrom(ProgressStack source) {
    this.readFrom(source, 0);
  }

  private void readFrom(ProgressStack stack, int index) {
    if (index >= stack.size())
      return;
    Progress progress = stack.get(index);
    this.caption = progress.getCaption();
    this.minValue = progress.getMinValue();
    this.maxValue = progress.getMaxValue();
    this.position = progress.getPosition();
    this.message = progress.getMessage();
    if (index + 1 < stack.size()) {
      this.child = new BProgress();
      this.child.readFrom(stack, index + 1);
    }
  }

  public String getCaption() {
    return caption;
  }

  public void setCaption(String caption) {
    this.caption = caption;
  }

  public BProgress getChild() {
    return child;
  }

  public void setChild(BProgress child) {
    this.child = child;
  }

  public float getMaxValue() {
    return maxValue;
  }

  public void setMaxValue(float maxValue) {
    this.maxValue = maxValue;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public float getMinValue() {
    return minValue;
  }

  public void setMinValue(float minValue) {
    this.minValue = minValue;
  }

  public float getPosition() {
    return position;
  }

  public void setPosition(float position) {
    this.position = position;
  }

}
